package com.kelvin.oocl.multidownload;


import java.io.IOException;
import java.io.RandomAccessFile;

public class FileDownloader extends Thread{
	  
      private byte[] bs ;
      private long skip ;
      private RandomAccessFile rfread ;
      private RandomAccessFile rfwrite ;
	
	  

	public FileDownloader( long skip, int readLength,
			RandomAccessFile rfread, RandomAccessFile rfwrite) {
		super();
		this.skip = skip;
		this.rfread = rfread;
		this.rfwrite = rfwrite;
		bs = new byte[readLength];
	}


	public void run(){
		 try {
			 rfread.seek(skip);
			 rfread.read(bs);
			 rfwrite.seek(skip);
			 rfwrite.write(bs);
			 System.out.println("the end");
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		   
		
	}
}
